#include "src/point.h"

namespace pathfind {

IntPoint::IntPoint() : x(0), y(0) {}

IntPoint::IntPoint(int x, int y) : x(x), y(y) {}

IntPoint::IntPoint(const IntPoint &p) {
  x = p.x;
  y = p.y;
}

void IntPoint::set(int x1, int y1) {
  x = x1; y = y1;
}

bool IntPoint::operator<(const IntPoint &p) const {
  if (x == p.x)
    return y < p.y;

  return x < p.x;
}

bool IntPoint::operator>(const IntPoint &p) const {
  if (x == p.x)
    return y > p.y;

  return x > p.x;
}

bool IntPoint::operator==(const IntPoint &p) const {
  return x == p.x && y == p.y;
}

bool IntPoint::operator!=(const IntPoint &p) const {
  return *this == p ? false : true;
}

IntPoint &IntPoint::operator=(const IntPoint &p) {
  if (this == &p)
    return *this;

  x = p.x;
  y = p.y;
  return *this;
}

std::ostream &operator<<(std::ostream &out, const IntPoint &p) {
  out << "(" << p.x << "," << p.y << ")";
  return out;
}
}
